﻿
@model Category
@{
    ViewBag.Title = $"{(Model == null || Model.Id == 0 ? "新增" : "编辑")}分类";
}
<form method="post" class="form-horizontal" asp-action="Edit">
    @Html.HiddenFor(m => m.Id)
    @if (ViewContext.ModelState.ErrorCount > 0)
    {
        <div asp-validation-summary="All" class="alert alert-danger"></div>
    }
    <div class="form-group">
        <div class="row">
            <label asp-for="Name" class="col-1"></label>
            <div class="col-4">
                <input type="text" class="form-control" asp-for="Name" placeholder="分类的名称" maxlength="30" />
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="row">
            <label asp-for="OrderNo" class="control-label col-1"></label>
            <div class="col-3">
                <input class="form-control text-center" style="width:100px;" asp-for="OrderNo" placeholder="从小到大排序" value="@(Model==null?0: Model.OrderNo)" />
                <span asp-validation-for="OrderNo" class="text-danger"></span>
            </div>
            <div class="col- text-muted">排序从小到大。</div>
        </div>
    </div>
    <div class="form-group">
        <button type="submit" class="btn btn-primary">提 交</button>
        <a asp-action="List" class="btn btn-default">返 回</a>
    </div>
</form>
@section scripts{
    @Html.Partial("~/Pages/Shared/_ValidationScripts.cshtml")
}